<?php
use yii\widgets\ActiveForm;
?>
<div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-5">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>元素</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" href="form_editors.html#">
                                <i class="fa fa-wrench"></i>
                            </a>
                           
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <?php ActiveForm::begin([
                            'options'=>['class'=>'form-horizontal m-t'],
                        ]);?>
                        <!-- <form action="" method="post" class="form-horizontal m-t"> -->
                            <div class="form-group draggable">
                                <label class="col-sm-3 control-label">用户名：</label>
                                <div class="col-sm-9">
                                    <input type="text" name="admin_name" class="form-control" placeholder="用户名">
                                </div>
                            </div>
                            <div class="form-group draggable">
                                <label class="col-sm-3 control-label">密码：</label>
                                <div class="col-sm-9">
                                    <input type="password" class="form-control" name="admin_pwd" placeholder="请输入密码">
                                </div>
                            </div>
                            <div class="form-group draggable">
                                <label class="col-sm-3 control-label">角色：</label>

                                <div class="col-sm-9">
                                <?php foreach($roles as $key => $val):?>
                                    <label class="checkbox-inline">
                                        <input type="checkbox" value="<?=$val['role_id']?>" id="inlineCheckbox1" name="role_id[]"><?=$val['role_name']?></label>
                                   <?php endforeach;?>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group draggable">
                                <div class="col-sm-12 col-sm-offset-3">
                                    <button class="btn btn-primary" type="submit">保存内容</button>
                                    <button class="btn btn-white" type="submit">取消</button>
                                </div>
                            </div>
                        <!-- </form> -->
                        <?php ActiveForm::end()?>
                    </div>
                </div>
            </div>
            <center><h1>添加管理员</h1></center>
            <!-- ------------------------------------------------------------ -->
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>基本 <small>分类，查找</small></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" href="table_data_tables.html#">
                                <i class="fa fa-wrench"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">

                        <table class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                                <tr>
                                    <th>管理员ID</th>
                                    <th>管理员名称</th>
                                    <th>拥有的角色</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php foreach($admins as $key => $val):?>
                                <tr class="gradeX">
                                    <td><?=$val['admin_id']?></td>
                                    <td><?=$val['admin_name']?></td>
                                    <?php  foreach($val['roles'] as $k => $v):?>
                                        <tr class="gradeX">
                                            <td></td>
                                            <td></td>
                                            <td><?=$v['role_name']?></td>
                                        </tr>
                                  <?php endforeach;?>
                                </tr>
                              <?php endforeach;?>
                            </tbody>
                            <tfoot>
                               
                            </tfoot>
                        </table>

                    </div>
                </div>
            </div>
            <!-- --------------------------------------------------------------- -->
        </div>
    </div>